<?php

declare(strict_types=1);
/**
 * This file is part of habo_new_media.
 *
 * @link     https://www.berlen.cn/
 * @contact  tech@berlen.cn
 * @license  http://gitlab.rehou.cn/habo/habo_new_media/-/blob/master/README.md
 */
namespace app\command;

use app\enum\CommonEnum;
use app\enum\QqEnum;
use app\enum\TokenEnum;
use app\model\ClientAccountModel;
use app\model\CrontabTaskModel;
use app\model\QqMaterialPicDailyReportExtModel;
use app\model\QqMaterialPicDailyReportHistoryExtModel;
use app\model\QqMaterialPicDailyReportHistoryModel;
use app\model\QqMaterialPicDailyReportModel;
use app\model\QqPicModel;
use app\service\client\AccountService;
use app\service\CrontabTaskService;
use app\service\qq\FinanceService;
use think\console\Input;
use think\console\input\Argument;
use think\console\Output;
use think\db\exception\DataNotFoundException;
use think\db\exception\DbException;
use think\db\exception\ModelNotFoundException;
use think\facade\Cache;
use think\facade\Db;

class QqMaterialPicDailyReportRecallWork extends BaseWork implements DailyStatWork
{
    public string $tag;

    public array $clientAccountInfo = [];

    /**
     * 设置任务标识.
     * @param mixed $tag
     */
    public function setTag($tag = ''): bool
    {
        if (! is_null($tag)) {
            $this->tag = strval($tag);
        }
        return true;
    }

    /**
     * 获取任务标识.
     */
    public function getTag(): string
    {
        return $this->tag;
    }

    /**
     * 获取脚本名.
     */
    public function getCommandName(): string
    {
        return $this->getName();
    }

    /**
     * 获取定时任务.
     * @throws DataNotFoundException
     * @throws DbException
     * @throws ModelNotFoundException
     */
    public function getCrontabTaskInfo(): CrontabTaskModel
    {
        $where = [
            ['task_name', '=', $this->getName()],
            //            ['tag', '=', $this->getTag()],
        ];

        $obj = new CrontabTaskModel();
        $model = $obj->where($where)->field(true)->find();
        return $model instanceof CrontabTaskModel ? $model : $obj;
    }

    protected function configure()
    {
        // 指令配置
        $this->setName('qq_material_pic_daily_report_recall_work');
        $this->setDescription('广点通-图片素材日流水回溯');
        $this->addArgument('type', Argument::REQUIRED, '类型  1：主表 2：历史数据表');
        $this->addArgument('start_date', Argument::OPTIONAL, '开始日期');
        $this->addArgument('end_date', Argument::OPTIONAL, '结束日期');
    }

    protected function execute(Input $input, Output $output)
    {
        set_time_limit(0);
        ini_set('memory_limit', '-1');
        $output->writeln('=======广点通-素材日流水拉取开始' . date('Y-m-d H:i:s', time()) . '=======');

        $type = intval($input->getArgument('type'));
        $startDates = $input->getArgument('start_date');
        $endDates = $input->getArgument('end_date');

        if (! $startDates || ! $endDates) {
            $output->writeln('===========开始时间，结束时间都必须存在！===========');
            return;
        }

        if ($startDates > $endDates) {
            $output->writeln('===========开始时间必须小于结束时间！===========');
            return;
        }

        $redis = Cache::store('redis')->handler();
        $redisKey = 'task:qq_pic_recall';
        $date = createDateRange($startDates, $endDates);
        $dateR = array_chunk($date, 10);
        for ($i = 0; $i < 20; ++$i) {
            $account = $redis->lPop($redisKey);
            if ($account) {
                $account = explode('_', $account);
                $advertiserId = $account[0];
                $execNum = intval($account[1]);
                $this->clientAccountInfo = $this->_getClientAccountInfo($advertiserId);
                if (! $this->clientAccountInfo) {
                    $err = ['params' => ['token' => '', 'advertiserId' => $advertiserId], 'response' => ['qq client account info is empty！']];
                    $output->writeln('=======error:' . json_encode($err, JSON_UNESCAPED_UNICODE) . '=======');
//                    logss($this->getDescription(), $this->getName(), $err);
                    CrontabTaskService::fallPushList($redis, $redisKey, $advertiserId, $execNum, json_encode($err, JSON_UNESCAPED_UNICODE));
                    return;
                }
                foreach ($dateR as $da) {
                    $tmp = true;
                    $startDate = $da[0];
                    $endDate = $da[count($da) - 1];
                    $page = 0;
                    while (true) {
                        $token = AccountService::getToken(CommonEnum::QQ_MEDIA, $advertiserId, TokenEnum::QQ_API_TOKEN_DAILY_COST);
                        if (! $token) {
                            CrontabTaskService::fallPushList($redis, $redisKey, $advertiserId, $execNum, 'token获取失败');
                            $tmp = false;
                            break;
                        }
                        ++$page;

                        $result = $this->_getServiceMaterialDailyReport($token, $advertiserId, $startDate, $endDate, $page);
                        if (! $result) {
                            $err = ['params' => ['token' => $token, 'advertiserId' => $advertiserId, 'startDate' => $startDate, 'endDate' => $endDate, 'page' => $page], 'response' => FinanceService::getError(0)];
                            $output->writeln('=======error:' . json_encode($err, JSON_UNESCAPED_UNICODE) . '=======');
//                            logss($this->getDescription(), $this->getName(), $err);
                            CrontabTaskService::fallPushList($redis, $redisKey, $advertiserId, $execNum, json_encode($err, JSON_UNESCAPED_UNICODE));
                            $tmp = false;
                            usleep(rand(800000, 1000000));
                            break;
                        }
                        if ($result['code'] != 0) {
                            $err = ['params' => ['token' => $token, 'advertiserId' => $advertiserId, 'startDate' => $startDate, 'endDate' => $endDate, 'page' => $page], 'response' => ''];
                            $output->writeln('=======error:' . json_encode($err, JSON_UNESCAPED_UNICODE) . '=======');
                            CrontabTaskService::fallPushList($redis, $redisKey, $advertiserId, $execNum, json_encode($err, JSON_UNESCAPED_UNICODE));
                            $tmp = false;
                            usleep(rand(800000, 1500000));
                            break;
                        }

                        $list = $result['data']['list'];
                        if (count($list) == 0) {
                            break;
                        }

                        foreach ($list as $v) {
                            $statDate = intval(date('Ymd', strtotime($v['date'])));
                            $statInfo = $this->_getMaterialDailyReportInfo($advertiserId, $statDate, $v['material_id'], $type);
                            if (! empty($statInfo)) {
                                if (! $this->_isReportDataUpdate($statInfo, $v)) {
                                    $result = $this->_updateMaterialData($statInfo['id'], $v, $type);
                                }
                            } else {
                                $result = $this->_insertMaterialData($advertiserId, $v, $type);
                            }
                        }
                    }
                    if (! $tmp) {
                        break;
                    }
                }
            }
        }

        $output->writeln('=======广点通-素材日流水拉取结束' . date('Y-m-d H:i:s', time()) . '=======');
        $output->writeln('success');
    }

    /**
     * 获取账户信息.
     * @param string $advertiserId 账户ID
     * @throws
     */
    private function _getClientAccountInfo(string $advertiserId = ''): array
    {
        $info = (new ClientAccountModel())->where('advertiser_id', $advertiserId)->field(true)->find();

        if (! $info) {
            return [];
        }
        return $info->toArray();
    }

    /**
     * 判断是否需要更新.
     * @param array $oldData 旧数据
     * @param array $newData 新数据
     */
    private function _isReportDataUpdate(array $oldData = [], array $newData = []): bool
    {
        $one = $oldData['cost'] == $newData['cost'];

        if ($one) {
            return true;
        }

        return false;
    }

    /**
     * @throws
     */
    private function _getQqPicInfo(string $advertiserId = '', string $picId = ''): array
    {
        $where = [
            ['advertiser_id', '=', $advertiserId],
            ['image_id', '=', $picId],
        ];

        $info = (new QqPicModel())->where($where)->field(true)->find();

        if (! $info) {
            return [];
        }

        return $info->toArray();
    }

    /**
     * 插入广告素材流水信息.
     * @param string $advertiserId 账户ID
     * @param array $info 信息数据
     */
    private function _insertMaterialData(string $advertiserId = '', array $info = [], int $type = 1): bool
    {
        try {
            $materialId = $info['material_id'];
            if (! isset($materialId)) {
                return false;
            }

            Db::startTrans();
            $picInfo = $this->_getQqPicInfo($advertiserId, $materialId);
            $signature = '';
            if (! empty($picInfo)) {
                $signature = $picInfo['signature'];
            }

            $statDate = date('Ymd', strtotime($info['date']));
            $data = [
                'company_id' => $this->clientAccountInfo['company_id'],
                'client_id' => $this->clientAccountInfo['client_id'],
                'account_id' => $this->clientAccountInfo['id'],
                'advertiser_id' => $advertiserId,
                'stat_date' => $statDate,
                'pic_id' => $materialId,
                'signature' => $signature,
                'cost' => $info['cost'],
                'create_time' => time(),
            ];

            if ($type == 1) {
                $insertId = (new QqMaterialPicDailyReportModel())->insertGetId($data);
            } else {
                $insertId = (new QqMaterialPicDailyReportHistoryModel())->insertGetId($data);
            }

            if ($insertId <= 0) {
                Db::rollback();
                return false;
            }

            $extData = [
                'company_id' => $this->clientAccountInfo['company_id'],
                'client_id' => $this->clientAccountInfo['client_id'],
                'account_id' => $this->clientAccountInfo['id'],
                'report_id' => $insertId,
                'advertiser_id' => $advertiserId,
                'stat_date' => $statDate,
                'content' => json_encode($info, JSON_UNESCAPED_UNICODE),
                'create_time' => time(),
            ];

            if ($type == 1) {
                $extInsertId = (new QqMaterialPicDailyReportExtModel())->insertGetId($extData);
            } else {
                $extInsertId = (new QqMaterialPicDailyReportHistoryExtModel())->insertGetId($extData);
            }

            if ($extInsertId <= 0) {
                Db::rollback();
                return false;
            }

            Db::commit();
            return true;
        } catch (\Exception $e) {
            return self::setError($e->getMessage());
        }
    }

    /**
     * @param string $advertiserId 账户ID
     * @param int $statDate 时间
     * @param string $videoId 图片文件ID
     * @throws
     */
    private function _getMaterialDailyReportInfo(string $advertiserId = '', int $statDate = 0, string $picId = '', int $type = 1): array
    {
        $where = [
            ['stat_date', '=', $statDate],
            ['advertiser_id', '=', $advertiserId],
            ['pic_id', '=', $picId],
            // ['signature', '=', $signature],
        ];

        $fields = [
            '*',
            "CONCAT(stat_date,'_',advertiser_id,'_',pic_id,'_',signature) as k",
        ];

        if ($type == 1) {
            $info = (new QqMaterialPicDailyReportModel())->where($where)->field($fields)->find();
        } else {
            $info = (new QqMaterialPicDailyReportHistoryModel())->where($where)->field($fields)->find();
        }

        if (! $info) {
            return [];
        }
        return $info->toArray();
    }

    /**
     * 修改广告素材流水信息.
     * @param int $id 主键ID
     * @param array $info 信息数据
     */
    private function _updateMaterialData(int $id = 0, array $info = [], int $type = 1): bool
    {
        try {
            /*if (! isset($info['material_id'])) {
                return false;
            }*/

            $data = [
                'cost' => $info['cost'],
                'update_time' => time(),
            ];

            $extData = [
                'content' => json_encode($info, JSON_UNESCAPED_UNICODE),
                'update_time' => time(),
            ];

            Db::startTrans();
            if ($type == 1) {
                $one = (new QqMaterialPicDailyReportModel())->where('id', $id)->update($data);
                $two = (new QqMaterialPicDailyReportExtModel())->where('report_id', $id)->update($extData);
            } else {
                $one = (new QqMaterialPicDailyReportHistoryModel())->where('id', $id)->update($data);
                $two = (new QqMaterialPicDailyReportHistoryExtModel())->where('report_id', $id)->update($extData);
            }

            if ($one && $two) {
                Db::commit();
                return true;
            }

            Db::rollback();
            return false;
        } catch (\Exception $e) {
            return self::setError($e->getMessage());
        }
    }

    /**
     * 获取获取广告账户流水信息.
     * @param string $token token
     * @param string $advertiserId 账户ID
     * @param string $startDate 开始时间
     * @param string $endDate 结束 时间
     * @return bool|mixed|string
     */
    private function _getServiceMaterialDailyReport(string $token = '', string $advertiserId = '', string $startDate = '', string $endDate = '', int $page = 1)
    {
        $params = [
            'access_token' => $token,
            'account_id' => $advertiserId,
            'date_range' => [
                'start_date' => $startDate,
                'end_date' => $endDate,
            ],
            'level' => QqEnum::REPORT_LEVEL_MATERIAL_PIC,
            'group_by' => ['date', 'material_id'],
            'fields' => $this->_getFileds(),
            'page' => $page,
            'page_size' => QqEnum::MATERIAL_MAX_PAGE_SIZE,
        ];

        return FinanceService::_getServiceMaterialDailyReport($params);
    }

    /**
     * 参数初始化.
     */
    private function _initParam(array $params = []): array
    {
        $now = time();
        $params['timestamp'] = $now;
        $params['nonce'] = uniqid(strval($now));

        return $params;
    }

    /**
     * 获取字段.
     * @return string[]
     */
    private function _getFileds(): array
    {
        return [
            'material_id',
            'account_id',
            'date',
            'view_count',
            'download_count',
            'activated_count',
            'activated_rate',
            'thousand_display_price',
            'valid_click_count',
            'ctr',
            'cpc',
            'cost',
            'key_page_view_cost',
            'coupon_click_count',
            'coupon_issue_count',
            'coupon_get_count',
            'platform_page_view_count',
            'platform_page_view_rate',
            'web_commodity_page_view_count',
            'web_commodity_page_view_cost',
            'web_register_count',
            'page_consult_count',
            'page_consult_cost',
            'page_phone_call_direct_count',
            'page_phone_call_direct_cost',
            'page_phone_call_back_count',
            'page_phone_call_back_cost',
            'own_page_navigation_count',
            'own_page_navi_cost',
            'platform_page_navigation_count',
            'platform_page_navigation_cost',
            'platform_shop_navigation_count',
            'platform_shop_navigation_cost',
            'web_application_count',
            'web_application_cost',
            'page_reservation_count',
            'page_reservation_by_display_count',
            'page_reservation_by_click_count',
            'page_reservation_rate',
            'page_reservation_cost',
            'page_reservation_cost_with_people',
            'web_add_to_cart_count',
            'web_add_to_cart_cost',
            'add_to_cart_price',
            'own_page_coupon_get_count',
            'own_page_coupon_get_cost',
            'platform_coupon_get_count',
            'platform_coupon_get_cost',
            'web_order_count',
            'order_by_display_count',
            'order_by_click_count',
            'web_order_rate',
            'order_by_display_rate',
            'order_by_click_rate',
            'app_order_rate',
            'web_order_cost',
            'order_by_display_cost',
            'order_by_click_cost',
            'web_checkout_amount',
            'web_checkout_count',
            'web_checkout_cost',
            'order_amount',
            'order_by_display_amount',
            'order_by_click_amount',
            'order_unit_price',
            'order_roi',
            'order_by_display_roi',
            'order_by_click_roi',
            'deliver_count',
            'deliver_cost',
            'sign_in_count',
            'sign_in_cost',
            'download_rate',
            'download_cost',
            'install_count',
            'install_cost',
            'click_activated_rate',
            'activated_cost',
            'retention_count',
            'retention_rate',
            'app_retention_d3_rate',
            'app_retention_d5_rate',
            'app_retention_d7_rate',
            'app_key_page_retention_rate',
            'retention_cost',
            'key_page_view_count',
            'key_page_view_by_display_count',
            'key_page_view_by_click_count',
            'app_commodity_page_view_count',
            'app_commodity_page_view_by_display_count',
            'app_commodity_page_view_by_click_count',
            'app_commodity_page_view_rate',
            'web_commodity_page_view_rate',
            'app_commodity_page_view_cost',
            'app_register_count',
            'register_by_display_count',
            'register_by_click_count',
            'app_register_cost',
            'web_register_cost',
            'app_application_count',
            'app_application_cost',
            'app_add_to_cart_count',
            'add_to_cart_amount',
            'app_add_to_cart_cost',
            'app_order_count',
            'app_order_cost',
            'app_checkout_count',
            'app_checkout_by_display_count',
            'app_checkout_by_click_count',
            'app_checkout_amount',
            'app_checkout_cost',
            'platform_coupon_click_count',
            'platform_coupon_get_rate',
            'coupon_usage_number',
            'coupon_usage_cost',
            'coupon_usage_rate',
            'coupon_purchase_rate',
            'follow_count',
            'follow_cost',
            'forward_count',
            'forward_cost',
            'read_count',
            'read_cost',
            'praise_count',
            'praise_cost',
            'comment_count',
            'comment_cost',
            'inte_phone_count',
            'phone_call_count',
            'external_form_reservation_count',
            'app_ad_paying_users',
            'ad_pur_val_web',
            'ad_pur_val_app',
            'order_24h_count',
            'order_24h_by_display_count',
            'order_24h_by_click_count',
            'order_24h_rate',
            'order_24h_cost',
            'order_24h_amount',
            'order_24h_by_display_amount',
            'order_24h_by_click_amount',
            'order_24h_roi',
            'order_24h_by_display_roi',
            'order_24h_by_click_roi',
            'game_create_role_count',
            'game_authorize_count',
            'game_tutorial_finish_count',
            'effective_leads_count',
            'effective_cost',
            'effective_reserve_count',
            'effective_consult_count',
            'effective_phone_count',
            'potential_reserve_count',
            'potential_consult_count',
            'potential_phone_count',
            'app_checkout_rate',
            'web_checkout_rate',
            'app_activated_checkout_rate',
            'web_activated_checkout_rate',
            'app_register_rate',
            'web_reg_rate',
            'page_phone_call_direct_rate',
            'page_phone_call_back_rate',
            'page_consult_rate',
            'deliver_rate',
            'install_rate',
            'arppu_cost',
            'arpu_cost',
            'web_arppu_cost',
            'web_arpu_cost',
            'app_ad_pur_arpu_cost',
            'app_ad_pur_arppu_cost',
            'web_ad_pur_arpu_cost',
            'cheout_fd',
            'cheout_td',
            'cheout_ow',
            'cheout_tw',
            'cheout_om',
            'cheout_fd_reward',
            'cheout_td_reward',
            'cheout_ow_reward',
            'cheout_tw_reward',
            'cheout_om_reward',
            'cheout_total_reward',
            'from_follow_uv',
            'from_follow_by_display_uv',
            'from_follow_by_click_uv',
            'from_follow_cost',
            'from_follow_by_display_cost',
            'from_follow_by_click_cost',
            'add_desktop_pv',
            'add_desktop_cost',
            'first_pay_count',
            'wechat_local_pay_count',
            'wechat_local_payuser_count',
            'wechat_local_pay_amount',
            'wechat_local_pay_roi',
            'first_pay_rate',
            'pre_cre_web',
            'pre_cre_app',
            'pre_cre_web_val',
            'pre_cre_app_val',
            'cre_web',
            'cre_app',
            'cre_web_val',
            'cre_app_val',
            'withdr_dep_web',
            'withdr_dep_app',
            'withdr_dep_web_val',
            'withdr_dep_app_val',
            'first_pay_cost',
            'landing_page_click_count',
            'web_cart_amount',
            'scan_follow_count',
            'scan_follow_user_count',
            'scan_follow_user_cost',
            'scan_follow_user_rate',
            'app_order_amount',
            'web_order_amount',
            'phone_consult_count',
            'tool_consult_count',
            'lottery_leads_count',
            'lottery_leads_cost',
            'conversions_count',
            'conversions_by_click_count',
            'conversions_by_display_count',
            'conversions_rate',
            'conversions_by_display_rate',
            'conversions_by_click_rate',
            'conversions_cost',
            'conversions_by_display_cost',
            'conversions_by_click_cost',
            'deep_conversions_count',
            'deep_conversions_rate',
            'deep_conversions_cost',
            'first_memcard_web_count',
            'first_memcard_app_count',
            'memcard_web_count',
            'memcard_app_count',
            'first_memcard_web_rate',
            'first_memcard_app_rate',
            'first_memcard_web_cost',
            'first_memcard_app_cost',
            'valuable_click_count',
            'valuable_click_rate',
            'valuable_click_cost',
            'video_play_count',
            'click_image_count',
            'click_detail_count',
            'click_head_count',
            'click_nick_count',
            'click_poi_count',
            'video_inner_play_count',
            'lan_button_click_count',
            'lan_jump_button_clickers',
            'lan_jump_button_click_cost',
            'lan_jump_button_ctr',
            'lan_button_click_cost',
            'cpn_click_button_count',
            'cpn_click_button_uv',
            'key_page_uv',
            'special_page_exp_uv',
            'special_page_exp_cost',
            'view_commodity_page_uv',
            'effect_leads_purchase_count',
            'reservation_uv',
            'overall_leads_purchase_count',
            'leads_purchase_count',
            'leads_purchase_rate',
            'leads_purchase_cost',
            'leads_purchase_uv',
            'valid_leads_uv',
            'phone_call_uv',
            'valid_phone_uv',
            'potential_customer_phone_uv',
            'web_register_uv',
            'web_apply_uv',
            'web_credit_uv',
            'app_apply_uv',
            'app_pre_credit_uv',
            'app_credit_uv',
            'app_withdraw_uv',
            'wechat_app_register_uv',
            'no_interest_count',
            'first_day_order_count',
            'first_day_order_by_display_count',
            'first_day_order_by_click_count',
            'first_day_order_amount',
            'first_day_order_by_display_amount',
            'first_day_order_by_click_amount',
            'add_wishlist_count',
            'video_outer_play10_count',
            'video_outer_play25_count',
            'video_outer_play50_count',
            'video_outer_play75_count',
            'video_outer_play90_count',
            'video_outer_play95_count',
            'video_outer_play100_count',
            'video_outer_play_time_count',
            'video_outer_play_time_avg_rate',
            'video_outer_play_rate',
            'video_outer_play_cost',
            'video_outer_play_count',
            'video_outer_play3s_count',
            'video_outer_play5s_count',
            'video_outer_play7s_count',
            'effect_leads_purchase_cost',
            'cre_web_cost',
            'cre_app_cost',
            'pre_cre_web_cost',
            'pre_cre_app_cost',
            'store_visitor',
            'try_out_user',
            'consult_leave_info_users',
            'active_page_views',
            'active_page_viewers',
            'active_page_interaction_amount',
            'active_page_interaction_users',
            'join_chat_group_amount',
            'join_chat_group_number_of_people',
            'join_chat_group_cost_by_people',
            'guide_to_follow_page_views',
            'guide_to_follow_page_viewers',
            'guide_to_follow_page_interaction_amount',
            'guide_to_follow_page_interaction_users',
            'mini_game_register_users',
            'mini_game_register_cost',
            'mini_game_register_rate',
            'mini_game_ad_monetization_users',
            'mini_game_paying_count',
            'mini_game_paying_amount',
            'mini_game_first_paying_users',
            'mini_game_create_role_users',
            'mini_game_create_role_cost',
            'mini_game_retention_d1',
            'app_retention_d3_uv',
            'app_retention_d5_uv',
            'app_retention_d7_uv',
            'mini_game_key_page_viewers',
            'mini_game_key_page_view_cost',
            'mini_game_ad_monetization_amount',
            'mini_game_paying_amount_by_upload',
            'mini_game_paying_count_by_upload',
            'consult_leave_info_cost',
            'purchase_amount_with_coupon',
            'purchase_amount_with_coupon_cost',
            'mini_game_paying_amount_click_d1_by_upload',
            'mini_game_retention_d1_rate',
            'mini_game_retention_d1_cost',
            'app_retention_d3_cost',
            'app_retention_d5_cost',
            'app_retention_d7_cost',
            'key_page_view_rate',
            'wechat_cost_stage1',
            'wechat_cost_stage2',
            'wechat_deep_conversions_count_stage1',
            'wechat_deep_conversions_count_stage2',
            'wechat_shallow_conversions_count_stage1',
            'wechat_shallow_conversions_count_stage2',
            'activate_register_rate',
            'key_behavior_conversions_count',
            'key_behavior_conversions_cost',
            'key_behavior_conversions_rate',
            'first_day_order_roi',
            'mini_game_ad_monetization_cost',
            'mini_game_ad_monetization_roi',
            'mini_game_ad_monetization_arpu',
            'mini_game_paying_roi',
            'mini_game_paying_arpu',
            'zone_header_click_count',
            'basic_info_client_count',
            'account_info_click_count',
            'activity_info_click_count',
            'clk_redpocket_btn_get_pv',
            'clk_redpocket_btn_share_pv',
            'clk_redpocket_btn_jump_pv',
            'clk_goods_header_pv',
            'clk_goods_info_pv',
            'clk_goods_recommend_pv',
            'clk_middle_showwindow_pv',
            'clk_footer_pv',
            'clk_middle_goods_pv',
            'clk_middle_btn_pv',
            'clk_middle_section_pv',
            'clk_middle_gridview_pv',
            'mini_game_bf_uv',
            'mini_game_bf_cost',
            'mini_game_bf_income_uv',
            'mini_game_bf_income_amount',
            'mini_game_bf_income_cost',
            'mini_game_bf_income_roi',
            'mini_game_bf_income_arpu',
            'mini_game_bf_income_d1_uv',
            'mini_game_bf_income_d1_amount',
            'mini_game_bf_income_d1_cost',
            'mini_game_bf_income_d1_roi',
            'mini_game_bf_income_d1_arpu',
            'mini_game_bf_purchase_uv',
            'mini_game_bf_purchase_amount',
            'mini_game_bf_purchase_cost',
            'mini_game_bf_purchase_roi',
            'mini_game_bf_purchase_arpu',
            'mini_game_bf_purchase_d1_uv',
            'mini_game_bf_purchase_d1_amount',
            'mini_game_bf_purchase_d1_cost',
            'mini_game_bf_purchase_d1_roi',
            'mini_game_bf_purchase_d1_arpu',
            'mini_game_create_role_rate',
            'consult_uv_count',
            'video_follow_count',
            'video_heart_count',
            'video_comment_count',
            'video_live_subscribe_count',
            'video_live_exp_count',
            'video_live_heart_count',
            'video_live_comment_count',
            'video_live_share_count',
            'video_live_cick_commodity_count',
            'live_stream_exp_uv',
            'video_live_heart_user_count',
            'video_live_comment_user_count',
            'video_live_share_user_count',
            'video_live_click_commodity_user_count',
            'video_live_commodity_bubble_exp_count',
            'scan_code_add_fans_uv',
            'scan_code_add_fans_count',
            'scan_code_add_fans_uv_cost',
            'scan_code_add_fans_count_cost',
            'biz_follow_count',
            'biz_follow_uv',
            'biz_follow_cost',
            'biz_follow_rate',
            'biz_reg_count',
            'biz_reg_uv',
            'biz_reg_rate',
            'biz_reg_cost',
            'biz_reg_order_amount',
            'biz_reg_roi',
            'biz_reservation_count',
            'biz_reservation_uv',
            'biz_reservation_rate',
            'biz_reservation_cost',
            'biz_reservation_amount',
            'biz_reservation_roi',
            'biz_order_count',
            'biz_order_uv',
            'biz_order_rate',
            'biz_order_cost',
            'biz_order_roi',
            'biz_order_amount',
            'biz_1d_order_count',
            'biz_1d_order_amount',
            'biz_purchase_count',
            'biz_purchase_amount',
            'biz_purchase_roi',
            'biz_consult_count',
            'biz_reading_count',
            'biz_page_apply_count',
            'biz_page_apply_uv',
            'biz_page_apply_cost',
            'biz_page_apply_rate',
            'biz_credit_count',
            'biz_credit_cost',
            'biz_credit_rate',
            'biz_credit_uv',
            'biz_deposit_count',
            'biz_1d_purchase_count',
            'biz_1d_purchase_amount',
            'biz_3d_purchase_count',
            'biz_3d_purchase_amount',
            'biz_7d_purchase_count',
            'biz_7d_purchase_amount',
            'biz_15d_purchase_count',
            'biz_15d_purchase_amount',
            'biz_30d_purchase_count',
            'biz_30d_purchase_amount',
            'biz_1d_purchase_roi',
            'biz_3d_purchase_roi',
            'biz_7d_purchase_roi',
            'biz_15d_purchase_roi',
            'biz_30d_purchase_roi',
            'stay_pay_7d_pv',
            'stay_pay_15d_pv',
            'stay_pay_30d_pv',
            'live_stream_crt_click_cnt',
            'live_stream_avg_time',
            'live_stream_commodity_shop_bag_clk_pv',
            'live_stream_commodity_shop_list_exp_pv',
            'live_stream_commodity_bubble_clk_pv',
            'live_stream_order_pv',
            'live_stream_order_amount',
            'biz_pre_credit_pv',
            'biz_pre_credit_uv',
            'biz_pre_credit_uv_cost',
            'biz_withdraw_deposits_uv',
            'biz_withdraw_deposits_uv_cost',
            'cheout_pv_1d',
            'cheout_pv_3d',
            'cheout_pv_5d',
            'cheout_pv_7d',
            'cheout_1d_cost',
            'cheout_3d_cost',
            'cheout_5d_cost',
            'cheout_7d_cost',
            'cheout_1d_rate',
            'cheout_3d_rate',
            'cheout_5d_rate',
            'cheout_7d_rate',
            'clk_redpocket_shake_pv',
            'clk_redpocket_shake_uv',
            'reg_all_dedup_pv',
            'reg_dedup_pv',
            // 'reg_cost_pla',
            // 'reg_click_rate_pla',
        ];
    }
}
